using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using SapaFinance.Domain.Model;

namespace SapaFinance.Domain.EntityFramework
{
    internal class IdentityConfiguration : EntityTypeConfiguration<Identity>
    {
        public IdentityConfiguration()
        {
            ToTable(typeof (Identity).Name.ToLower());
            HasKey(x => x.UID);
            Property(x => x.UID).HasColumnName("id").HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            Property(x => x.DateTime).HasColumnName("datetime").IsRequired();
            HasRequired(p => p.User).WithMany().Map(m => m.MapKey("userid")).WillCascadeOnDelete(true);
        }


    }
}